package org.websocket;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author: wxl
 * @CreateTime: 2023/2/19 16:41
 */
@Configuration
@EnableWebSocket
@EnableConfigurationProperties({EasyWebSocketProperties.class})
public class EnableAutoEasyWebSocketConfiguration {

    @Resource
    private EasyWebSocketProperties properties;

    @Bean
    public EasyWebSocketConfiguration webSocketConfiguration () {
        EasyWebSocketConfiguration webSocketConfiguration = new EasyWebSocketConfiguration();
        webSocketConfiguration.setEndPoint(properties.getEndPoint());
        return webSocketConfiguration;
    }

}
